package com.dou.you.che.service.impl.sys;

import com.dou.you.che.comm.utils.IdUtil;
import com.dou.you.che.core.entity.sys.SysOss;
import com.dou.you.che.core.mapper.sys.SysOssDao;
import com.dou.you.che.service.sys.SysOssServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * OSS
 * @Author 黄国刚【1058118328@qq.com】
 */
@Service
@Transactional(readOnly = true)
public class SysOssService implements SysOssServiceI{

    @Autowired
    private SysOssDao sysOssDao;

    @Override
    public SysOss queryObject(String id) {
        return sysOssDao.queryObject(id);
    }

    @Override
    public List<SysOss> queryList(Map<String, Object> map) {
        return sysOssDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return sysOssDao.queryTotal(map);
    }

    @Transactional(readOnly = false)
    @Override
    public void save(SysOss sysOss) {
        sysOss.setId(IdUtil.createIdbyUUID());
        sysOss.setCreateTime(new Date());
        sysOssDao.save(sysOss);
    }

    @Transactional(readOnly = false)
    @Override
    public void update(SysOss sysOss) {
        sysOssDao.update(sysOss);
    }

    @Transactional(readOnly = false)
    @Override
    public void delete(String id) {
        sysOssDao.delete(id);
    }

    @Transactional(readOnly = false)
    @Override
    public void deleteBatch(String[] ids) {
        sysOssDao.deleteBatch(ids);
    }
}
